package com.bjzspace.lwq.mybatis.generator;

import org.assertj.core.util.Lists;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;

import java.io.File;

public class MyBatisGeneratorCode {

    public static void main(String[] args) throws Exception {

        String path = Thread.currentThread().getContextClassLoader().getResource("/").getPath();
        File configFile = new File(path + "mybatis/mybatis-generator-configuration.xml");

        ConfigurationParser cp = new ConfigurationParser(Lists.newArrayList());

        Configuration config = cp.parseConfiguration(configFile);

        DefaultShellCallback callback = new DefaultShellCallback(true);

        MyBatisGenerator generator = new MyBatisGenerator(config, callback, Lists.newArrayList());

        generator.generate(null);

    }

}
